package daobeauty.interceptor.returntype.handler.impl;

import java.util.List;
import java.util.Vector;

import daobeauty.interceptor.returntype.handler.ReturnTypeHandler;

/**
 * ReturnTypeHandler for methods returning a Vector.
 * 
 * @author M. Serhat Cinar
 *
 */
public class VectorReturnType implements ReturnTypeHandler<Vector> {

	/**
	 * Creates a new Vector and adds all elements of the List to the Vector.
	 * 
	 * @see daobeauty.interceptor.returntype.handler.ReturnTypeHandler#convert(java.util.List)
	 */
	@SuppressWarnings("unchecked")
	public Vector convert(List result) {
		return new Vector(result);
	}

	/**
	 * Creates a new Vector and adds the Object to the Vector.
	 * 
	 * @see daobeauty.interceptor.returntype.handler.ReturnTypeHandler#convert(java.lang.Object)
	 */
	@SuppressWarnings("unchecked")
	public Vector convert(Object result) {
		final Vector vector = new Vector(1);
		vector.add(result);
		return vector;
	}
}
